<!--个人信息-->
<div class="wrap">
	<div class="header">
		<a href="javascript:void(0)" id="passwordBtn">修改密码</a>
	</div>
	<!--详情内容-->
	<ul class="order_list">
		<li>
			<label>工号</label>
			<span id="id"></span>
		</li>
		<li>
			<label>姓名</label>
			<span id="name"></span>
		</li>
		<li>
			<label>手机号码</label>
			<span id="tel"></span>
		</li>
		<li>
			<label>所属部门</label>
			<span id="class"></span>
		</li>
	</ul>
</div>
<!--修改密码-->
<div class="layout">
	<div class="alert">
		<h3>修改密码</h3>
		<p>
			<label>手机号</label>
			<input type="text" id="phone">
		</p>
		<p>
			<label>旧密码</label>
			<input type="password" id="oldpwd">
		</p>
		<p>
			<label>新密码</label>
			<input type="password" id="newpwd">
		</p>
		<p>
			<a href="javascript:void(0)" id="sureBtn">确定</a>
			<a href="javascript:void(0)" id="cancelBtn">取消</a>
		</p>
	</div>
</div>
<script>
	//部门id
	$("#id").text($.cookie("uid"));
	//姓名
	$("#name").text($.cookie("userName"));
	//手机号码
	$("#tel").text($.cookie("phone"));
	//所属部门
	$("#class").text($.cookie("clerk"));
	//修改密码
	$("#passwordBtn").on("click",function(){
		$(".layout").show();
		$(".alert").show();
		$("#phone").val($.cookie("phone"));
	})
	//取消
	$("#cancelBtn").on("click",function(){
		$(".layout").hide();
		$(".alert").hide();
	})
	//确定
	$("#sureBtn").on("click",function(){
		var phone = $("#phone").val(),
			oldpwd = $("#oldpwd").val(),
			newpwd = $("#newpwd").val();
		$.ajax({
			type:"post",
			url:"http://39.108.164.20/device/SysUser/UpdatePwd",
			dataType:"json",
			data:{
				phone:phone,
				oldpwd:oldpwd,
				newpwd:newpwd
			},
			success:function(res){
				alert(res.result.msg);
				$(".layout").hide();
				$(".alert").hide();
			}
		});
	})
</script>
